setOrNull

fun setOrNull(index: Int, element: E): E?
fun setOrNull(index: PositiveInt, element: E): E?
fun setOrNull(index: StrictlyPositiveInt, element: E): E?

Replaces the element at the specified index in this list with the specified element, or returns null if the index is out of bounds.